<?php

define('PERMISSION_ALLOW', 'allow');
define('PERMISSION_DENY', 'deny');

/**
 * Class CustomerModuleGroupLogic
 */
class CustomerModuleGroupLogic extends Model
{
    private $_customerId = null;
    private $_modelCustomerModuleGroup = null;

    public function __construct()
    {
        $this->_customerId = Session::$user['customerId'];
        Session::switchCustomer(0);

        $this->_modelCustomerModuleGroup = D('CustomerModuleGroup');

        Session::switchCustomer($this->_customerId);
    }

    /** --------------------------------------  增  -------------------------------------- */
    /** --------------------------------------  删  -------------------------------------- */
    /** --------------------------------------  改  -------------------------------------- */
    /** --------------------------------------  查  -------------------------------------- */

    public function getModuleByCid($cid)
    {
        return $this->_modelCustomerModuleGroup->where(['customerId' => $cid, 'permission' => PERMISSION_ALLOW])->getField('group', TRUE);
    }

}